import time

from selenium import webdriver
from selenium.webdriver.common.by import By

from utils.get_filepath import get_logo_path

path = get_logo_path()
print("打印出来这个path结果是{0}".format(path))
drive = webdriver.Chrome()
drive.maximize_window()
drive.get("https://sahitest.com/demo/php/fileUpload.htm")
time.sleep(1)
# 获取input文件上传元素
# 针对input标签上传文件
upload = drive.find_element(By.ID, "file")
# 发送文件路径
upload.send_keys(r"{}".format(path))
# 点击提交按钮
drive.find_element(By.NAME, "submit").click()
time.sleep(3)
drive.close()
